import request from '@/utils/request'

enum API {
  ADDROLE_URL = '/role/addrole',
  GETROLELIST_URL = '/role/list',
  DELETEROLE_URL = '/role/delete',
  UPDATEROLE_URL = '/role/update',
}

//增加角色
export const addRole = (params:any)=>{
    return request.post(API.ADDROLE_URL,params)
}

//获取角色列表
export const getRoleList = (page:number,limit:number,rolename?:string)=>{
    return request.get(`${API.GETROLELIST_URL}?page=${page}&limit=${limit}&rolename=${rolename}`)
}

//删除角色
export const deleteRole = (id:number)=>{
    return request.delete(`${API.DELETEROLE_URL}?id=${id}`)
}

//更新角色
export const updateRole = (params:any)=>{
    return request.post(API.UPDATEROLE_URL,params)
}

//批量删除角色
export const deleteRoles = (ids:number[])=>{
    return request.delete(`${API.DELETEROLE_URL}?id=${ids}`)
}

